<% provide(:title, '考试中') %>
<div class="home-page">
  <div class="text-center">
    <h1><strong><%= @exam.title %></strong></h1>
    <h2><%= @exam.description %></h2>
  </div>
  <div class="form-exam">
    <div class="login-wrap">
      <%= form_for(@respondent) do |f| %>
          <%= f.hidden_field :exam_id, value: @exam.id %>
          <%= render 'shared/error_messages', object: f.object %>
          <%= f.label :姓名 %>
          <%= f.text_field :student_name, class: 'form-control' %>
          <%= f.label :学号 %>
          <%= f.text_field :student_id, class: 'form-control' %>
          </div>
          <ol>
            <!-- list all multi_questions for the exam -->
            <% if @exam.has_multi_questions? %>
                <% @time = 1 %>
                <% @exam.all_multi_questions_with_text.each do |multi_question| %>
                    <div class="container">
                      <h3><strong><%= @time %>.<%= multi_question.text.capitalize %></strong></h3>
                      <% @time += 1 %>
                      <%= f.fields_for :multi_responses do |multi_response| %>
                          <%= multi_response.hidden_field :question_id, value: multi_question.id %>
                          <%= multi_response.collection_check_boxes :response_option_ids, multi_question.response_options, :id, :text, {}, class: "checkbox" %>
                      <% end %>
                    </div>
                <% end %>
            <% end %> <!-- end of the multi_questions -->
          </ol>
          <div class="form-signin">
            <div class="login-wrap">
              <%= f.submit "完成答卷", class: "btn btn-primary btn-lg btn-block " %>
            </div>
          </div>
      <% end %>
      </div>
</div>


